fix(codex): 远端 compact 密文失败走同一任务换窗 - #3529
Conversation
订阅会话 remote compact 撞 invalid_encrypted_content 时,原样重试必败, 且 HTTP 静默剥推理密文够不到这条路径。把它当成官方 compact 确定性失败, 复用现有 host-controlled rollover:同一条任务交接重建并重放用户消息, 不再要求用户开新任务或 Fork。单独的 invalid_encrypted_content 仍留给 静默剥密文,避免供应商切换被误换窗。 Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/shared/remote-compact-encrypted-error.ts | 新增窄范围双条件分类器,避免将单独的密文错误误判为换窗条件。 |
| packages/maker-core/src/agents/codex/translator.ts | 将 error notification 中的 message 与 additionalDetails 联合分类,并复用稳定的 context-overflow reason。 |
| packages/maker-core/src/agents/codex/index.ts | 在权威的 turn.completed 失败路径中同步标记远端 compact 密文错误。 |
| apps/desktop/src/main/maker-ipc/contextOverflowRollover.ts | 将新错误类型接入现有 rollover 检测,同时保留远程会话和副作用相关安全边界。 |
| apps/desktop/src/main/maker-ipc/tests/contextOverflowRollover.test.ts | 覆盖即时恢复、下次发送前重建及单独密文错误不触发换窗的行为。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Codex 远端 compact] --> B{错误文本同时包含<br/>remote compact 与<br/>invalid_encrypted_content?}
B -->|否| C[保留原错误处理]
B -->|是| D[标记 context-overflow]
D --> E{本地会话且可安全重放?}
E -->|否| F[Fail closed]
E -->|是| G[关闭旧 native thread]
G --> H[写入上下文交接]
H --> I[重放当前用户消息]
Reviews (1): Last reviewed commit: "fix(codex): 远端 compact 密文失败走同一任务换窗" | Re-trigger Greptile
|
@dashhuang 👋 这个 PR 目前与 请在本地 merge 最新的 |
MagicLizi
left a comment
There was a problem hiding this comment.
独立审查通过:把远端 compact 的 invalid_encrypted_content 接到与满窗相同的 host-controlled 换窗路径,并避开单独的推理密文 400。当前 head 与 origin/main 在 rollover / translator 上有实质冲突,Approve 后仍不能合并。
MagicLizi
left a comment
There was a problem hiding this comment.
独立审查 head a482b7a8d26ddc45585fcad54fdef46cd91c5be5:无 P0,有 1 条 P1,本轮不能合。
packages/maker-core/src/agents/codex/index.ts:10887
CodexAgent 在 translateErrorNotification 之前先走 recordHttpRecoveryIntent。armCodexHttpRecovery 用 INVALID_ENCRYPTED_CONTENT_RE 匹配任意含 invalid_encrypted_content 的文本(包括 Error running remote compact task: … invalid_encrypted_content)。订阅会话有 scoped WS 时会吞掉终态 error、把 thread 标成 HTTP-only 并走 retryTurnViaHttpRecovery,到不了本 PR 在 translator 打上的 context-overflow。HTTP strip 会跳过 compaction blob,这次重投必败。请在 isRemoteCompactEncryptedContentError(message + additionalDetails) 为真时不要 arm HTTP recovery,让现有 overflow 分类和 rollover 落地;并在 websocket body recovery 套件加 remote compact 密文 400 fixture。
这次改了什么
摘要
Codex 订阅会话做远端压缩时,如果历史里有解不开的
encrypted_content,上游直接 400:Error running remote compact task+invalid_encrypted_content。这条失败原样重试必败;HTTP 静默剥推理密文也够不到 compact / WebSocket。用户只能开新任务或手动 Fork。本 PR 把它当成官方 compact 的确定性失败,接到现有同一任务换窗(host-controlled rollover):关掉旧 native thread、写交接、重放刚才那句用户消息。新任务不用用户去开,也不走 Fork 并剥离。单独的
invalid_encrypted_content(供应商切换时 HTTP 还能剥推理密文)不会被误判成换窗。设计上接着 #3510 的「官方压不动就同一任务换窗」,但不改 #3510,独立合入。
变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档与工程维护范围
invalid_encrypted_content,新任务正常。isRemoteCompactEncryptedContentError:必须同时命中remote compact与invalid_encrypted_contentcontext-overflowreasoncontextOverflowRollover把这类错误当成可重建prepareUnhealthySessionUI 变化
contextRebuild分隔样式与chat.errorBanner.contextOverflow文案。怎么验证的
自动验证
pnpm test:unit:related因改了 maker-core 公共导出而拉了全量 desktop。其中 maker-core related 通过。desktop 全量有环境性失败(claudeOrphanReaper、portReclaim、usageHistory、以及若干ioregcollect 失败),与本 diff 无关;#3510 也曾在干净 main 上复现同类基线项。CI 全量pnpm test:unit为准。手工验证
未在安装版 Cindy 上用真实 GPT-5.6 Sol 旧任务复现换窗。分类与 rollover 由单测覆盖用户截图中的文案形态。
未执行的验证
真机:打开已报
Error running remote compact task的旧 Codex 任务,发下一条,确认同一任务交接并继续。device-link / SSH 未手测(SSH 本就拒绝本地换窗)。风险
风险分类
context-overflow换窗;交接会丢掉 native 历史细节,只保留摘要。本轮已有工具副作用时不自动 replay。影响与回滚
提交前检查
git commit -s,见 DCO)